import java.util.Scanner;

public class BiteDay40 {
    //最长上升子序列
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while(sc.hasNextInt()){
            int n = sc.nextInt();
            int[] arr = new int[n];
            for(int i = 0; i < n; i++){
                arr[i] = sc.nextInt();
            }
            int[] dp = new int[n];
            dp[0] = 1;
            for(int i = 1; i < n; i++){
                int cnt = 1;
                for(int j = 0; j < i; j++){
                    if(arr[i] > arr[j]){
                        cnt = Math.max(cnt, dp[j] + 1);
                    }
                }
                dp[i] = cnt;
            }
            System.out.println(dp[n - 1]);
        }
    }

}
